fix(scripts): add empty description validation and branch checkout error handling#1559
fix(scripts): add empty description validation and branch checkout error handling#1559zaheer15351 wants to merge 1 commit intogithub:mainfrom
Conversation
…ror handling Adds two critical improvements to both PowerShell and Bash feature creation scripts: 1. Post-trim validation: Prevents creating features with whitespace-only descriptions 2. Branch checkout error handling: Provides clear error messages when branch creation fails (e.g., branch already exists) instead of silently continuing Co-authored-by: Augment Agent <noreply@augmentcode.com>
There was a problem hiding this comment.
Pull request overview
This PR enhances the feature creation scripts by adding robust input validation and error handling for common failure scenarios. The changes prevent edge cases where users provide invalid input or attempt to create duplicate branches, providing clear and actionable error messages instead of silent failures.
Changes:
- Added post-trim validation to prevent features with whitespace-only descriptions from being created
- Implemented explicit error handling for git branch creation failures with specific messages for duplicate branches versus other errors
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| scripts/powershell/create-new-feature.ps1 | Added whitespace-only description validation and branch creation error handling with detailed error messages |
| scripts/bash/create-new-feature.sh | Added whitespace-only description validation and branch creation error handling with detailed error messages |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| $branchCreated = $false | ||
| try { | ||
| git checkout -b $branchName | Out-Null | ||
| git checkout -b $branchName 2>&1 | Out-Null |
There was a problem hiding this comment.
The stderr redirection 2>&1 is inconsistent with other git commands in this file, which use 2>$null. For consistency and to match the pattern used elsewhere (lines 88, 115, 145, 263), this should be 2>$null | Out-Null instead of 2>&1 | Out-Null.
| git checkout -b $branchName 2>&1 | Out-Null | |
| git checkout -b $branchName 2>$null | Out-Null |
Adds two critical improvements to both PowerShell and Bash feature creation scripts: